// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

.osu-switch-v2 {
  @_top: osu-switch-v2;

  flex: none;
  display: inline-flex;
  cursor: pointer;
  align-items: baseline;
  font-size: inherit;
  text-transform: none;
  margin: 0 5px 0 0;

  &--grid {
    margin: 0;
  }

  &__input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
  }

  &__content {
    .center-content();
    width: 1.5em;
    height: 1.5em;
    display: flex;
    color: hsla(var(--hsl-h1), 0.5);
    border: 2px solid currentColor;

    &::after {
      opacity: 0;
    }

    .@{_top}--disabled & {
      opacity: 0.5;
    }

    .@{_top}__input:checked + & {
      color: @osu-colour-h1;

      &::after {
        opacity: 1;
      }
    }

    .@{_top}__input[type="checkbox"] + & {
      border-radius: 0.5em;

      &::after {
        .fas();
        content: @fa-var-check;
      }
    }

    .@{_top}__input[type="checkbox"][data-indeterminate="true"] + & {
      color: hsl(var(--hsl-h1));

      &::after {
        .fas();
        content: @fa-var-minus;
        opacity: 1;
      }
    }

    .@{_top}__input[type="radio"] + & {
      border-radius: 50%;

      &::after {
        content: "";
        background-color: currentColor;
        border-radius: 50%;
        width: calc(100% - 6px);
        height: calc(100% - 6px);
      }
    }
  }
}
